package com.collect.zambia.zhiAdater.zhiLevelDetail;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.collect.zambia.R;
import com.collect.zambia.zhiBean.zhiReceive.ZHIRCollecterPerformanceEntity;

public class ZHILevelDetailCollectGrouperB15Column extends BaseQuickAdapter<ZHIRCollecterPerformanceEntity, BaseViewHolder> {

    private ZHILevelDetailCollectMember5ColumnClickListener mZHILevelDetailCollectMember5ColumnClickListener;

    public ZHILevelDetailCollectGrouperB15Column() {
        super(R.layout.item_level_detail_column_5, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, ZHIRCollecterPerformanceEntity item) {
        helper.setText(R.id.tv_col_0, item.getAssignDateFormatDisplay());
        helper.setText(R.id.tv_col_1, item.getAssignNumFormatInt()+"");
        helper.setText(R.id.tv_col_2, item.getTaskNumFormatInt()+"");
        helper.setText(R.id.tv_col_3, item.getRepayNumFormat());
        helper.setText(R.id.tv_col_4, item.getActualBonusFormat());

        TextView tv_col_0 = helper.getView(R.id.tv_col_0);
        TextView tv_col_1 = helper.getView(R.id.tv_col_1);
        TextView tv_col_2 = helper.getView(R.id.tv_col_2);
        TextView tv_col_3 = helper.getView(R.id.tv_col_3);
        TextView tv_col_4 = helper.getView(R.id.tv_col_4);

        tv_col_0.setOnClickListener(v -> {
            if(mZHILevelDetailCollectMember5ColumnClickListener!=null){
                mZHILevelDetailCollectMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_1.setOnClickListener(v -> {
            if(mZHILevelDetailCollectMember5ColumnClickListener!=null){
                mZHILevelDetailCollectMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_2.setOnClickListener(v -> {
            if(mZHILevelDetailCollectMember5ColumnClickListener!=null){
                mZHILevelDetailCollectMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_3.setOnClickListener(v -> {
            if(mZHILevelDetailCollectMember5ColumnClickListener!=null){
                mZHILevelDetailCollectMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_4.setOnClickListener(v -> {
            if(mZHILevelDetailCollectMember5ColumnClickListener!=null){
                mZHILevelDetailCollectMember5ColumnClickListener.onItemClick(item);
            }
        });
    }

    public void setColumnItemClick(ZHILevelDetailCollectMember5ColumnClickListener listener){
        mZHILevelDetailCollectMember5ColumnClickListener = listener;
    }

    public interface ZHILevelDetailCollectMember5ColumnClickListener {
        void onItemClick(ZHIRCollecterPerformanceEntity item);
    }
}
